<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="/common/taglibs.jsp"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户列表</title>
<link rel="stylesheet" type="text/css" href="${ctx}/css/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/css/easyui/demo.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/css/easyui/themes/icon.css">
	<script type="text/javascript" src="${ctx}/js/easyui/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/easyui/src/jquery.parser.js"></script>
	 <script type="text/javascript" src="${ctx}/js/scripts/JSONUtil.js"></script>
	 <script type="text/javascript" src="${ctx}/js/easyui/local/easyui-lang-zh_CN.js"></script>
	 <script type="text/javascript">
	 
	 $(function(){
			$('#ftpList').datagrid({
				title:"ftp文件列表",
				iconCls:'icon-save',
				height:350,
				nowrap: true,
				autoRowHeight: false,
				striped: true,
				collapsible:true,
				url:'${ctx}/ftpUpload/getFtpList',
				sortName: 'attaId',
				sortOrder: 'desc',
				remoteSort: false,
				idField:'attaId',
				columns:[[
				          {field:'attaName',title:'视频名',width:500,
				        	  formatter: function(value,row,index){
				           	 return '<a href="#" onclick="viewTab(\'' + row.attaId+ '\')">'+row.attaName+'</a>  '	
				          }  	},
				          {field:'attaType',title:'视频类型',width:100},
				          {field:'createDate',title:'创建日期',width:100},
				          {field:'updateDate',title:'修改日期',width:100},
				]],
				pagination:true,
				rownumbers:true,
				toolbar:"#toolbar"
			});
			var p = $('#ftpList').datagrid('getPager');
			$(p).pagination({
				onBeforeRefresh:function(){
					alert('before refresh');
				}
			});
			
			
		});
	
	 /* 模态方式打开供应商考核标准录入页面 */
	    function addTab(){	      
	    	document.location.href="${ctx}/ftpUpload/goUpload";
	    }
	function editTab(){
		var  iWidth=880; //模态窗口宽度
    	var  iHeight=280;//模态窗口高度
    	var iTop=(window.screen.height-iHeight)/2; 
    	var iLeft=(window.screen.width-iWidth)/2; 
		var param="";
		 var rows = $("#ftpList").datagrid("getSelections");
	      if (rows.length == 0) {
	        $.messager.alert("请选择一条信息","提示");
	        return;
	      }
	      var id = rows[0].id;
		param = "?operWay=2&id="+id ;
		var openStatus = "width=880,height=280,menubar=no,toolbar=no,top="+iTop+",left="+iLeft+",Location=no,scrollbars=no,status=no,modal=yes";
		
		window.open("${ctx}/user/userAddOrUpdate"+param, window, openStatus);
		
	    
		
	}
	function viewTab(id){
		window.open("${ctx}/ftpUpload/ftpDownOrEdit?id="+id+"&operWay=3",(new Date()).getTime());
		
	}
	function searchTab(){
		
	}
	
	  /* 刷新DataGrid表单 */
    function refreshGrid(params){
      if(typeof params == "undefined" || params == null){
         params = {};
      }
      $('#ftpList').datagrid("options").pageNumber = 1;   
      //分页栏上跳转到第一页   
      $('#ftpList').datagrid('getPager').pagination({pageNumber: 1});
      // 刷新DataGrid表单
      $("#ftpList").datagrid('reload',params);
      $('#ftpList').datagrid('clearSelections');
    }
 	$(window).resize(function(){
		$('#ftpList').datagrid('resize', {
		width:function(){return document.body.clientWidth/2;},
		height:function(){return document.body.clientHeight/2;},
		});
		}); 
	</script>
	 <style type="text/css">
       
    </style>
	
</head>
<body >
	<h2>ftp文件列表</h2>
	<div class="demo-info">
		<div class="demo-tip icon-tip"></div>
		<div>Click the button to do actions with datagrid.</div>
	</div>
	
   <div id="toolbar">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addTab()">上传</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editTab()">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-view" plain="true" onclick="editTab()">New</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-view" plain="true" onclick="editTab()">Destroy</a>
    </div>
          <table  id="ftpList"  ></table>
           
</body>
</html>